//
//  ChooseHotCarCollectionCell.m
//  CarUser
//
//  Created by 王森林 on 2018/12/11.
//  Copyright © 2018年 王森林. All rights reserved.
//

#import "ChooseHotCarCollectionCell.h"

@implementation ChooseHotCarCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
    
}

- (void)createUI
{
//           UIImageView *logoImageView = [UIImageView new];
//            logoImageView.image = IMG(imageName);
//            [btn addSubview:logoImageView];
//            logoImageView.frame = CGRectMake(0, 0, btnWidth, 60);
    [self.contentView removeAllSubviews];
    [self.contentView addSubview:self.logoImageView];
    [self.contentView  addSubview:self.titleLabel];
    self.logoImageView.frame =  CGRectMake(0, 0, 100, 60);
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.logoImageView.mas_bottom).offset(10);
        make.left.equalTo(self.contentView.mas_left);
        make.right.equalTo(self.contentView.mas_right);
        make.height.mas_equalTo(12);
    }];

    
}

- (void)setImageWithName:(NSString *)imageName withTitle:(NSString *)titleName
{
    
//    self.logoImageView.image = IMG(imageName);
    [self.logoImageView sd_setImageWithURL:[NSURL URLWithString:APPEND_URL(BASE_URL, imageName)]];
    self.titleLabel.text = titleName;
}

- (UIImageView *)logoImageView
{
    if (!_logoImageView) {
        _logoImageView = [UIImageView new];
    }
    return _logoImageView;
    
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textColor = RGB(40, 40, 40);
        _titleLabel.font = FONT_SIZE(12);
        _titleLabel.textAlignment = NSTextAlignmentCenter;

    }
    return _titleLabel;
    
}

@end
